<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="HeaderAndClass">

#if(NUNIT)

// NUNIT TEST FRAMEWORK FOR <xsl:value-of select="HeaderInfo/ProjectName"/>
// Tests Save and Delete of all classes



using NUnit.Framework;
using System;
using <xsl:value-of select="HeaderInfo/ProjectName"/>.DataObject;

namespace <xsl:value-of select="HeaderInfo/ProjectName"/>.NUnit  {

    [TestFixture]
    public class <xsl:value-of select="HeaderInfo/ProjectName"/>__NUnitTest {
    
    <xsl:for-each select="Classes/Class">
    <xsl:text>&#x9;</xsl:text><xsl:value-of select="Name"/> test<xsl:value-of select="Name"/>=null;
    </xsl:for-each>
    
    
    [SetUp]
    public void SetUp() {
        <xsl:for-each select="Classes/Class">
        test<xsl:value-of select="Name"/>=new <xsl:value-of select="Name"/>();</xsl:for-each>
    }
    
    <xsl:for-each select="Classes/Class">
    [Test]
    public void <xsl:value-of select="Name"/>__TEST() {
        Guid objectID=Guid.Empty;
        Assert.IsTrue(test<xsl:value-of select="Name"/>.Save(),"Save"); 
          
        Assert.IsFalse(test<xsl:value-of select="Name"/>.ObjectID.Equals(Guid.Empty),"ObjectID Empty Test");
          
        objectID=test<xsl:value-of select="Name"/>.ObjectID;
        test<xsl:value-of select="Name"/>=new <xsl:value-of select="Name"/>(objectID);
          
        Assert.IsFalse(test<xsl:value-of select="Name"/>.ObjectID.Equals(Guid.Empty),"Reload from constructor");
          
        Assert.IsTrue(test<xsl:value-of select="Name"/>.delete(),"Delete");      
    }  
    </xsl:for-each>
    
  }

}


#endif
  </xsl:template>  
</xsl:stylesheet>